package com.playcrab.adouban;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;

public class Doumail  extends TabActivity {
    /** Called when the activity is first created. */
	 private TabHost tabs;

    private static final String LOG_TAG = "Doumail";
        
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.doumail);
        
        Bundle bundle = this.getIntent().getExtras();
        String type = bundle.getString("type");
        Log.v(LOG_TAG,"type:"+type); 
        
        tabs = getTabHost();        
        TabHost.TabSpec inboxTab = tabs.newTabSpec("inbox");
        Intent inbox = new Intent(this, DoumailList.class);
        
        inbox.putExtra("type", "inbox");
        inboxTab.setContent(inbox);
        inboxTab.setIndicator(getString(R.string.doumail_inbox), this.getResources().getDrawable(R.drawable.inbox));
        tabs.addTab(inboxTab);

        TabHost.TabSpec outboxTab = tabs.newTabSpec("outbox");
        Intent outbox = new Intent(this, DoumailList.class);
       
        
        outbox.putExtra("type", "outbox");
        outboxTab.setContent(outbox);
        outboxTab.setIndicator(getString(R.string.doumail_outbox), this.getResources().getDrawable(R.drawable.outbox));
        tabs.addTab(outboxTab);
        
     
          
		 
        if(type.equalsIgnoreCase("inbox")){
        	tabs.setCurrentTab(0);
        }else if(type.equalsIgnoreCase("outbox")){
        	tabs.setCurrentTab(1);
        }else{
        	tabs.setCurrentTab(0);
        }
          
		
    }
       
}